/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Table;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import oracle.jdbc.pool.OracleDataSource;

/**
 *
 * @author Prasetyawan
 */
public class TabelPembelian {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       String url = "jdbc:oracle:thin:@localhost:1521:XE";
        String userId = "hr";
        String password = "HR";

//        String url = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
//        String userId = "mhs115314095";
//        String password = "mhs115314095";
        Connection conn;
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(url);
            conn = ds.getConnection(userId, password);
            Statement statement = conn.createStatement();
            System.out.println("Table Crated");

            String sql = "create table Pembelian (IdBakul varchar2(10) not null, NamaBakul varchar2(40) not null,"
                    + "constraint Bakul primary key (IdBakul) enable)";

            statement.executeUpdate(sql);
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
